import {ajaxRequest} from './request.js';
import API from './api.js';

var requests = {};
for (let key in API) {
    requests[key] = function (...args) {
        var url = API[key], type = 'post';
        if (typeof url === 'object') {
            type = url.type || 'post';
            url = url.url;
        }
        return ajaxRequest[type.toLowerCase()](url, ...args)
    }
}
export default requests;